<% gcp_project_id = "#{external_attribute(pwd, 'gcp_project_id', doc_generation)}" -%>
<% gcp_ext_vm_name = "#{external_attribute(pwd, 'gcp_ext_vm_name', doc_generation)}" -%>
<% gcp_location = "#{external_attribute(pwd, 'gcp_location', doc_generation)}" -%>
<% gcp_zone = "#{external_attribute(pwd, 'gcp_zone', doc_generation)}" -%>
<% target_pool = grab_attributes(pwd)['target_pool'] -%>
describe google_compute_target_pool(project: <%= gcp_project_id -%>, region: <%= gcp_location -%>, name: <%= doc_generation ? "'#{target_pool['name']}'" : "target_pool['name']" -%>) do
  it { should exist }
  its('session_affinity') { should eq <%= doc_generation ? "'#{target_pool['session_affinity']}'" : "target_pool['session_affinity']" -%> }
  it { should has_target_instance(<%= gcp_ext_vm_name -%>, <%= gcp_zone -%>) }
end

describe google_compute_target_pool(project: <%= gcp_project_id -%>, region: <%= gcp_location -%>, name: 'nonexistent') do
  it { should_not exist }
end